package com.ics.web.controller.travelstar.controller;

import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.AjaxResult;
import com.ics.web.controller.travelstar.domain.TravelstarContact;
import com.ics.web.controller.travelstar.dto.TravelstarContactDTO;
import com.ics.web.controller.travelstar.service.TravelstarContactService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;

/**
 * @author shaoly
 * @description
 * @ClassName TravelstarContactController.java
 * @createTime 2024年12月13日 11:29:19
 */
@RestController
@RequestMapping("/tires/contact")
@Api(value = "Contact Us", tags = "Contact Us")
public class TravelstarContactController extends BaseController {

    @Resource
    private TravelstarContactService contactService;

    /**
     * Contact Us列表
     */
    @ApiOperation("Contact Us列表")
    @GetMapping("/list")
    public AjaxResult list(TravelstarContactDTO contactDTO) {
        return success(contactService.listPage(contactDTO));
    }


    /**
     * Contact Us详情
     */
    @ApiOperation("Contact Us详情")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(contactService.getById(id));
    }

    /**
     * Contact Us新增
     */
    @ApiOperation("Contact Us新增")
    @PostMapping("/save")
    public AjaxResult save(@RequestBody TravelstarContact form) {
        return toAjax(contactService.saveOrUpdate(form));
    }


    /**
     * Contact Us删除
     */
    @ApiOperation("Contact Us删除")
    @PostMapping("/remove")
    public AjaxResult remove(@RequestParam("ids") String ids) {
        return toAjax(contactService.removeByIds(Arrays.asList(ids.split(","))));
    }


}
